package com.vg.spinner;

import java.util.ArrayList;

import com.androidhive.jsonparsing.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class Adapter_Gender extends ArrayAdapter<String> {

	private Context mContext;
	private String[] listName=new String[]{};
	ArrayList<String> array;
	public Adapter_Gender(Context context,int textViewResourceId,ArrayList<String> obj) {
		super(context,textViewResourceId,obj);
		// TODO Auto-generated constructor stub
		mContext = context;
		this.array = obj;
	}
	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		//return super.getDropDownView(position, convertView, parent);
		return getCustomView(position, convertView, parent);
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		//return super.getView(position, convertView, parent);
		return getCustomView(position, convertView, parent);
	}
	
	public View getCustomView(int position, View convertView, ViewGroup parent){
		
		 LayoutInflater layoutInflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	     View  viewRow=layoutInflate.inflate(R.layout.drop_gender, parent, false);
	     
	     String _id=new String();
	     _id=array.get(position);
	     
	     TextView tvgender = (TextView)viewRow.findViewById(R.id.tv_genderdrop);
	     tvgender.setText(_id);
	     
	     return viewRow;
	}
}
